import cv2
import numpy as np

class Preprocessor:
    def __init__(self):
        pass
    def apply(self, img, steps):
        """执行预处理流水线"""
        for step in steps:
            if step == 'gray':
                img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
            elif step == 'equalize':
                img = cv2.equalizeHist(img)
            elif step == 'smooth':
                img = cv2.GaussianBlur(img, (5,5), 0)
        return img